#!/bin/bash

# mkdir workspace
cd /root/ocean
gil update
rm -rf build
mkdir build
mkdir build/packages
mkdir build/gpu-static
mkdir build/gpu-shared

# build gpu static
cd build/gpu-static
cmake -DCMAKE_INSTALL_PREFIX=../packages/gpu-static -DCMAKE_INSTALL_LIBDIR=lib -DOCEAN_ENABLE_CUDA=ON -DOCEAN_BUILD_SHARED_LIBS=OFF ../../
make install -j24
cd  ../packages/gpu-static/
tar -cvzf /root/ocean/packages/ocean-${PACKAGES}-${VERSION}-`arch`-static.tar.gz *

# build gpu shared
cd /root/ocean/build/gpu-shared
cmake -DCMAKE_INSTALL_PREFIX=../packages/gpu-shared -DCMAKE_INSTALL_LIBDIR=lib -DOCEAN_ENABLE_CUDA=ON -DOCEAN_BUILD_SHARED_LIBS=ON ../../
make install -j24
cd ../packages/gpu-shared/
tar -cvzf /root/ocean/packages/ocean-${PACKAGES}-${VERSION}-`arch`-shared.tar.gz *